Ml and the Address Operator
نویسندگان
چکیده
ML supports references to objects through mutable ref cells: A program can create a ref cell from an object, and subsequently replace the object accessible through the cell by another. Unfortunately, ref cells, when compared to mechanisms for handling mutable data in other programming languages , impose awkward restrictions on programming style. Moreover, introducing ref cells into a program after the fact requires pervasive changes. This paper proposes a language extension to ML with pointers, a safe mechanism for dealing with mutable objects. The extension avoids the style and maintenance problems inherent in the ref cell mechanism. Modern programming languages such as Java, Scheme, and ML, use \safety" as an advertisement: A program cannot crash the system by dereferencing an invalid address. This achievement is largely due to two improvements over low-level languages such as C, Modula-2, or Pascal: Automatic Storage Management Garbage collection obviates the need for free or dispose calls which are dangerous because they make formerly valid pointers invalid. References are Boxes A program cannot take the address of an object and write through it later. Instead, it must create a reference (or box) for mutable data whose contents the program may change and whose extent is unlimited; the object in the box itself still does not become mutable. This last property appears in diierent forms across the spec-trum|Standard ML has ref cells, Objective Caml has record elds which are mutable by declaration, in Java all record elds and bindings are mutable, and Scheme has mu-table bindings, pairs and vectors. The expressiveness of all of these mechanisms is essentially the same. References-as-boxes have a strong bearing on programming pragmatics: While functional programming practice discourages the use of mutable data altogether, it is not always possible to do without it. Moreover, as appealing as the merits of pure functional programming are, mutable data structures are a powerful and frequently useful abstraction 1]. In ML, in order for a value to become mutable, the programmer must replace it by a reference|this means changes at all of its occurrences. This is syntactically inconvenient and generally awkward|the mutability of a value is of no consequence for most of its uses. Yet this fact becomes painfully obvious because the value becomes available only by dereference. For writing new programs, adding references is merely a nuisance. However, the issue becomes more serious when changing old ones, because the ensuing changes are usually far-reaching …
منابع مشابه
DYNAMIC PERFORMANCE OPTIMIZATION OF TRUSS STRUCTURES BASED ON AN IMPROVED MULTI-OBJECTIVE GROUP SEARCH OPTIMIZER
This paper presents an improved multi-objective group search optimizer (IMGSO) that is based on Pareto theory that is designed to handle multi-objective optimization problems. The optimizer includes improvements in three areas: the transition-feasible region is used to address constraints, the Dealer’s Principle is used to construct the non-dominated set, and the producer is updated using a tab...
متن کاملSome properties of the parametric relative operator entropy
The notion of entropy was introduced by Clausius in 1850, and some of the main steps towards the consolidation of the concept were taken by Boltzmann and Gibbs. Since then several extensions and reformulations have been developed in various disciplines with motivations and applications in different subjects, such as statistical mechanics, information theory, and dynamical systems. Fujii and Kam...
متن کاملبرنامه ریزی توسعه تولید انرژی الکتریکی و جایابی نیروگاه برپایه الگوریتم ژنتیک ارتقا یافته و فرایند تحلیل سلسله مراتبی
This paper presents a new approach to solve generation expansion planning (GEP) problem by improved Genetic Algorithm (IGA). GEP is a large-scale stochastic highly constraint nonlinear discrete dynamic optimization problem. Generation system planers tend to use many different methods to address the expansion problem and to determine optimum plans by minimizing the mathematical objective functio...
متن کاملInvestigating antimicrobial effect of Zataria extracts produced by ultrasound on salmonella typhimurium
Introduction: Zataria multiflora is a plant of the Lamias family. The most effective antimicrobial composition is its thymol and carvacrol. Salmonella typhimurium is a genus of Salmonella from the Enterobacteriaceae family. This gram-negative basil, optional aerobic or anaerobic, cause diseases such as inflammation of the intestine, systemic infection, and intestinal fever. Th...
متن کاملOn the fine spectra of the generalized difference operator Delta_{uv} over the sequence space c0
The main purpose of this paper is to detemine the fine spectrum of the generalized difference operator Delta_{uv} over the sequence space c0. These results are more general than the fine spectrum of the generalized difference operator Delta_{uv} of Srivastava and Kumar.
متن کاملTowards an ML-Style Polymorphic Type System for C
Advanced polymorphic type systems have come to play an important role in the world of functional programming. But, curiously, these type systems have so far had little impact upon widely-used imperative programming languages like C and C++. We show that ML-style polymorphism can be integrated smoothly into a dialect of C, which we call Polymorphic C. It has the same pointer operations as C, inc...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1998